package net.solvetheriddle;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class CrossroadsActivity extends ListActivity {
    
    String tests[] = { 
            "movement.SimpleMovementTest"
    };
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, tests));
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        StringBuilder itemName = new StringBuilder("net.solvetheriddle.");
        try {
            Class itemClass = Class.forName(itemName.append(tests[position]).toString());
            Intent itemActivityIntent = new Intent(this, itemClass);
            startActivity(itemActivityIntent);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    
}